public class FindMaxSubarrayBruteForce 
{
	public static void main(String[] args)
	{
		int[] A = {0, 13, -3, -25, 20, -3, -16, -23, -1, -2, 18, 20, -7, 12, -5, -22, 15, -4, 7};
		int maxSum = -1000;
		int left = 0;
		int right = 0;
		int sum = 0;
		int i,j;
		for (i = 1; i <=18; ++i)
		{
			sum = 0;
			for(j=i; j <= 18; ++j)
			{
				sum += A[j];
				if (sum > maxSum)
				{
					maxSum = sum;
					left = i;
					right = j;
				}
			}
		}
		if (maxSum < 0) 
		{
			System.out.println(left + "\n" + right + "\n" + 0);
		}
		else
			System.out.println(left + "\n" + right + "\n" + maxSum);
	}
}
